package com.handy.socket.demo;

import org.apache.log4j.Logger;

import com.handy.socket.EventAdapter;
import com.handy.socket.Request;
import com.handy.socket.Response;

public class ServerHandler extends EventAdapter {
    public void onError(String error) {
    }
    public void onAccept() throws Exception {
    }
    public void onAccepted(Request request)  throws Exception {
    }
    public void onRead(Request request)  throws Exception {
    	//request.getDataInput();
    	String str = new String(request.getDataInput());
    	log.info(str);
    }
    public void onWrite(Request request, Response response)  throws Exception {
    	response.send("success".getBytes());
    }
    public void onClosed(Request request)  throws Exception{
    }
    
    private static Logger log = Logger.getLogger(ServerHandler.class);
}
